{% extends 'admin/common/base.html' %}
{% block css %}
{{super()}}
<link href="{{url_for('admin.static',filename='ajax/libs/jasny/jasny-bootstrap.min.css')}}?v=3.1.3" rel="stylesheet"/>
{% endblock %}
{% block body %}
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form">
            <input type="hidden" name="id" value="{{d.id}}">
            <div class="form-group">
				<label class="col-sm-3 control-label ">名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="name" id="name" value="{{d.name}}" >
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">类型：</label>
				<div class="col-sm-8">
                    <select id="mtype" name="mtype" class="form-control m-b">
						{% for dd in get_dict_data('cms_material_type')%}
						<option value="{{dd.value}}" {{'selected' if d.mtype == dd.value else '' }}>{{dd.label}}</option>
						{% endfor %}
					</select>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">文件：</label>
				<div class="col-sm-8">
                    <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                        <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename">{{d.url}}</span></div>
                        <span class="input-group-addon btn btn-white btn-file"><span class="fileinput-new">选择文件</span><span class="fileinput-exists">更改</span><input type="file" name="url"></span>
                        <a href="#" class="input-group-addon btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
                    </div>
				</div>
			</div>
            <div class="form-group">
				<label class="col-sm-3 control-label ">备注：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="remark" id="remark" value="{{d.remark}}" >
				</div>
			</div>
		</form>
	</div>
</body>
{% endblock %}
{% block js %}
{{ super() }}
<script src="{{url_for('admin.static',filename='ajax/libs/jasny/jasny-bootstrap.min.js')}}?v=3.1.3"></script>
<script type="text/javascript">


    
    $("#form").validate({

    });
    
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save("{{url_for('admin.cms.material.edit')}}", new FormData(document.getElementById('form')));
        }
    }

</script>
{% endblock %}
